import React,{Component} from 'react';
import {
    StyleSheet,
    View,
    Text,
    StatusBar,
    Image,
    TouchableWithoutFeedback,
} from 'react-native';
import request from '../request/request';
import Header from './header/Header';
export default class AccountSecurity extends Component{
    constructor(props) {
        super(props);
        // 初始状态
        this.state = {
            
        };
    }
    componentWillMount(){
        // fetch('https://result.eolinker.com/XPZsElz98c92f9c243e2f760bf17420ef24906430bea331?uri=lindf.com',
        //     {
        //         method: 'POST',
        //     }
        // )
        // .then((response) => response.json())        // json方式解析，如果是text就是 response.text()
        // .then((responseData) => {   // 获取到的数据处理
        //     this.setState({
        //         newsList: responseData.result.lists,
        //     },function(){
        //         this.setState({
        //             hasData: true
        //         })
        //         console.log(this.state.newsList)
        //     });

        // })
        // .catch((error) => {     // 错误处理
        //     alert(error);
        // })
        // .done();
        
        // request(
        //     'POST', 
        //     '', 
        //     (data)=>{
        //         this.setState({
        //             newsList: data.result.lists,
        //         },function(){
        //             this.setState({
        //                 hasData: true,
        //                 showModal: false
        //             })
        //         });
        //         console.log(data.result);
        //     }
        //     ,
        //     (error)=>{
        //         console.log(error);
        //     }
        // );
    }

    render(){
        const { params } = this.props.navigation.state;
        const {navigate,goBack,state} = this.props.navigation;
        let barHeight = StatusBar.currentHeight;
        return (
            <View style={{
                flex: 1,
                // paddingTop: barHeight, 
                backgroundColor: '#eaeaea'
            }}>
                <Header isShowBack={true} title='账户安全' goBack={goBack} />

				<View style={styles.setBox}>
					<TouchableWithoutFeedback onPress={()=>navigate('ChangeMobile')}>
	                    <View style={styles.setBoxItem}>
	                        <Text style={styles.setBoxItemText}>修改绑定手机</Text>
	                        <Image style={styles.setBoxItemImage} source={require('../images/rightGo.png')}/>
	                    </View>
                    </TouchableWithoutFeedback>
                </View>
                <View style={styles.setBox}>
	                <TouchableWithoutFeedback onPress={()=>navigate('ChangePassword')}>
	                    <View style={styles.setBoxItem}>
	                        <Text style={styles.setBoxItemText}>修改登录密码</Text>
	                        <Image style={styles.setBoxItemImage} source={require('../images/rightGo.png')}/>
	                    </View>
	                </TouchableWithoutFeedback>
                </View>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    setBox: {backgroundColor: '#fff', paddingLeft: 12},
    setBoxItem: {flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingTop: 12, paddingBottom: 12, paddingRight: 12, borderBottomWidth: 1, borderColor: '#e9e9e9' },
    setBoxItemText: {fontSize: 14, color: '#000'},
    setBoxItemImage: {width: 8,height: 16},
})